﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace console_pictures_viewer
{
    class Progress
    {
        private float percent;
        private float top;
        private float bottom;

        public Progress(float top, float bottom)
        {
            this.top = top;
            this.bottom = bottom;
        }

        public void SetCurrent(float current)
        {
            if (current == top)
                percent = 100;
            else
                percent = (current - bottom) / (top - bottom) * 100;
        }

        public void Display()
        {
            Console.Write("\r");
            Console.Write("                        ");
            Console.Write("\r");
            if (percent != 100)
                Console.Write(percent + " %...");
            else
                Console.WriteLine("Done!");
        }
    }
}
